//
//  MoreMaterialViewController.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/19.
//

#import "MoreMaterialViewController.h"
#import "MoreMaterialCell.h"


#import "SavePhotoImageViewController.h"

@interface MoreMaterialViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *_Tabview;
    MoreMaterialCell *Cell;
}
@end

@implementation MoreMaterialViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //隐藏头部view
    self.navigationController.navigationBar.hidden = YES;
    NavigationHeadView *navgationheadv = [[NavigationHeadView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, SafeAreaTopHight)];
    navgationheadv.backgroundColor = [UIColor whiteColor];
    navgationheadv.titlelabel.text = @"招生素材";
    navgationheadv.titlelabel.textColor  = [UIColor blackColor];
    [navgationheadv.backbtn addTarget:self action:@selector(returnback) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:navgationheadv];
    
    _Tabview  = [[UITableView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight, APPwidth, APPheight+SafeAreaBottomHeight)];
    _Tabview.delegate = self;
    _Tabview.dataSource = self;
    _Tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_Tabview];
    
}
#pragma mark - UITableView DataSource

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 420;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString * str = @"cell";
    
    Cell  = [tableView dequeueReusableCellWithIdentifier:str];
    if (Cell == nil) {
        
        Cell = [[MoreMaterialCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:str];
    }
    
//    Cell.nameLab.text = @"学员:小芒果";
    UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pictureClick:)];
    gesture.numberOfTapsRequired = 1;
    
    [Cell.textView addGestureRecognizer:gesture];
    
    Cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return Cell;
}

#pragma mark - 图片点击
-(void)pictureClick:(UITapGestureRecognizer *)click{
    SavePhotoImageViewController *vc = [[SavePhotoImageViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}


-(void)returnback{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark -视图即将出现
-(void)viewWillAppear:(BOOL)animated{
        
    ((TabbarController *)self.tabBarController).tabBarView.hidden = YES;
    
}

@end
